Skip to content

test: migrate stats/incr/rss to ULP-based assertions - #16005

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-bxucz3
Oct 11, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-bxucz3

Conversation

@kgryte

@kgryte kgryte commented Oct 9, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for stats/incr/rss from relative tolerance testing to ULP difference testing.
  • replaces the @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires with @stdlib/assert/is-almost-same-value.
  • removes the delta/tol scratch variables and the actual === expected branch, replacing each comparison with t.strictEqual( isAlmostSameValue( actual, expected, 0 ), true, 'returns expected value' );.

Only test/test.js is modified; the package has no test/test.native.js.

ULP bounds

The package has a single test file, and both affected test cases use the same bound:

File ULP constant Notes
test/test.js 0 measured minimum

The previous assertions allowed 1.0 * EPS * abs( expected ). Measuring the actual ULP difference for every assertion in the fixture set (via @stdlib/number/float64/base/ulp-difference) yields 0 for all seven comparisons, so the accumulator is bit-exact against the naive reference for this data and 0 is the minimum required ULP value.

Verification:

  • make test TESTS_FILTER=".*/stats/incr/rss/.*" → 11 passing, 0 failing.
  • Suite run twice at the final ULP value to confirm determinism (no FMA/arch variation); identical results both runs.
  • Test-file ESLint (etc/eslint/.eslintrc.tests.js, via the pre-commit hook) reports no problems.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

The ULP value of 0 means isAlmostSameValue reduces to a SameValue comparison here. This matches the idiom already used in previously migrated packages in this family (e.g. stats/incr/mstdev, simulate/iter/periodic-sinc), where exactly representable results are asserted with a ULP value of 0 rather than being left as a tolerance comparison.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was authored by Claude Code running as an unattended scheduled task: it selected the package, studied the already-migrated packages to mirror the project's established idiom, applied the migration, and measured the minimum ULP bound empirically.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rg1yBjjTZyER7PGJBCkzga


Generated by Claude Code

Replaces relative tolerance comparisons with ULP difference assertions
using `@stdlib/assert/is-almost-same-value`. The accumulator returns
bit-exact results for the test data, so the minimum required ULP
difference is `0`.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg1yBjjTZyER7PGJBCkzga

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: skipped
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Good First PR A pull request resolving a Good First Issue. labels Oct 9, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/incr/rss $\\color{green}124/124$
$\\color{green}+100.00\\%$
$\\color{green}6/6$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}124/124$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Oct 11, 2026
@kgryte
kgryte marked this pull request as ready for review October 11, 2026 12:42
@kgryte
kgryte requested a review from a team October 11, 2026 12:42
@kgryte
kgryte merged commit 0b68eb3 into develop Oct 11, 2026
66 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-bxucz3 branch October 11, 2026 12:43
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants